home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / examples / dtksh / TextDisp1.z / TextDisp1
Encoding:
Text File  |  2003-11-18  |  3.3 KB  |  123 lines

  1. #! /usr/dt/bin/dtksh
  2. #
  3. # TextDisp1
  4. #
  5. # Copyright 2000, Silicon Graphics, Inc.
  6. # ALL RIGHTS RESERVED
  7. # UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8. # States.   Use of a copyright notice is precautionary only and does not
  9. # imply publication or disclosure.
  10. #
  11. # U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12. # Use, duplication or disclosure by the Government is subject to restrictions
  13. # as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14. # in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15. # in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16. # Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17. # 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18. #
  19. # THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20. # INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21. # DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22. # PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23. # GRAPHICS, INC.
  24. #
  25. ##########################################################################
  26. #  (c) Copyright 1993, 1994 Hewlett-Packard Company    
  27. #  (c) Copyright 1993, 1994 International Business Machines Corp.
  28. #  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. #  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  30. #      Novell, Inc.
  31. ##########################################################################
  32.  
  33.  
  34. #
  35. # This sample shell script exercises the commands which enable and disable
  36. # updating in a text widget.  If the update is disabled, and the value of
  37. # the text field is then changed, the text field will not update what is
  38. # shown, until update is again enabled.
  39. #
  40.  
  41. # Pushbutton Callback: enable update in the text widget
  42. EnableUpdate()
  43. {
  44.    XmTextEnableRedisplay $TEXT
  45. }
  46.  
  47. # Pushbutton Callback: disable update in the text widget
  48. DisableUpdate()
  49. {
  50.    XmTextDisableRedisplay $TEXT
  51. }
  52.  
  53. # Pushbutton Callback: changes the text value
  54. ChangeValue1()
  55. {
  56.    XmTextSetString $TEXT "line A
  57. line B
  58. line C
  59. line D
  60. line E
  61. line F
  62. line G"
  63. }
  64.  
  65. # Pushbutton Callback: changes the text value
  66. ChangeValue2()
  67. {
  68.    XmTextSetString $TEXT "line a
  69. line b
  70. line c
  71. line d
  72. line e
  73. line f
  74. line g"
  75. }
  76.  
  77.  
  78. ######################### Create the Main UI #################################
  79.  
  80. XtInitialize TOPLEVEL textDisp1 TextDisp1 "$0" "$@"
  81. XtSetValues $TOPLEVEL allowShellResize:True
  82.  
  83. XmCreateScrolledText TEXT $TOPLEVEL text \
  84.     columns:20 \
  85.     rows:5 \
  86.     editMode:MULTI_LINE_EDIT \
  87.     value:\
  88. "line 1
  89. line 2
  90. line 3
  91. line 4"
  92. XtManageChild $TEXT
  93.  
  94. XtRealizeWidget $TOPLEVEL
  95.  
  96. XtCreateApplicationShell TOPLEVEL2 textDisp1a TopLevelShell
  97.  
  98. XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
  99.          orientation:HORIZONTAL \
  100.          numColumns:2 \
  101.          packing:PACK_COLUMN 
  102.  
  103. XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
  104.     labelString:"Disable Update"
  105. XtAddCallback $PB1 activateCallback "DisableUpdate"
  106.  
  107. XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
  108.     labelString:"Enable Update"
  109. XtAddCallback $PB2 activateCallback "EnableUpdate"
  110.  
  111. XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
  112.     labelString:"Change Value 1"
  113. XtAddCallback $PB3 activateCallback "ChangeValue1"
  114.  
  115. XtCreateManagedWidget PB4 pb4 XmPushButton $RC \
  116.     labelString:"Change Value 2"
  117. XtAddCallback $PB4 activateCallback "ChangeValue2"
  118.  
  119. XtRealizeWidget $TOPLEVEL2
  120.  
  121. XtMainLoop
  122.